# Maintainer: Jelle van der Waa <jelle@archlinux.org>
# Contributor: Eli Schwartz <eschwartz@archlinux.org>
# Contributor: Alexander F Rødseth <xyproto@archlinux.org>
# Contributor: Chris Brannon <cmbrannon79@gmail.com>
# Contributor: Douglas Soares de Andrade
# Contributor: Roberto Alsina <ralsina@kde.org>

_pkgname=mechanize
pkgname=python-mechanize
pkgver=0.4.8
pkgrel=2
epoch=1
pkgdesc='Stateful programmatic web browsing in Python'
arch=('any')
url="https://github.com/python-mechanize/mechanize"
license=('BSD')
depends=('python-html5lib')
makedepends=('python-setuptools')
checkdepends=('python-zope-interface' 'python-twisted')
optdepends=('python-html5-parser: faster parsing of HTML')
source=("https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/${_pkgname}/${_pkgname}-${pkgver}.tar.gz"{,.asc})
sha256sums=('5e86ac0777357e006eb04cd28f7ed9f811d48dffa603d3891ac6d2b92280dc91'
            'SKIP')
b2sums=('bd91738092ac473ee6e65ee5f175479515f735a0433b112241f17061adf7e60ef6fa410fa549f088390b6ef6c8b2ff95e00335a626322ad170c88923c96e8e44'
        'SKIP')
validpgpkeys=('3CE1780F78DD88DF45194FD706BC317B515ACE7C') # Kovid Goyal (New longer key) <kovid@kovidgoyal.net>

build() {
  cd "mechanize-$pkgver"

  python setup.py build
}

check() {
  cd "mechanize-$pkgver"

  python run_tests.py
}

package() {
  cd "mechanize-$pkgver"

  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
